﻿using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;

namespace ConsoleApplication1
{
    class Program
    {
        //static void Main(string[] args)
        //{
        //    //  Restart();
        //    //  shutdown();
        //    showDate();

        //}

        public static readonly TimeSpan _whenTimeIsOver = new TimeSpan(18, 00, 00);
        internal static bool IsTimeOver()
        {
            return DateTime.Now.TimeOfDay.Subtract(_whenTimeIsOver).Ticks > 0;
        }
       
        private static void showDate()
        {
            DateTime theDate = DateTime.UtcNow;

            string custom = theDate.ToString("d");
            Console.WriteLine(custom);

            int d = (int)System.DateTime.Now.DayOfWeek;
            if (d == 1)
            {
                // Console.WriteLine("today is monday {0}",d); //this displays the interger no for the date
                Console.WriteLine("today is monday");
                Console.WriteLine("shutdown time is 6:00 pm");
                ShutDown.shutdown();
            }
            else if (d == 2)
            {
                Console.WriteLine("today is Tuesday");
                Console.WriteLine("shutdown time is 6:00 pm");
                ShutDown.shutdown();
            }
            else if (d == 3)
            {
                Console.WriteLine("today is Wenesday");
                Console.WriteLine("shutdown time is 6:00 pm");
                ShutDown.shutdown();
            }
            else if (d == 4)
            {
                Console.WriteLine("today is Thursday");
                Console.WriteLine("shutdown time is 6:00 pm");
                ShutDown.shutdown();
            }
            else if (d == 5)
            {
                Console.WriteLine("today is Friday");
                Console.WriteLine("shutdown time is 6:00 pm");
                ShutDown.shutdown();
            }
            else if (d == 6)
            {
                Console.WriteLine("today is which saturday");
                Console.WriteLine("shutdown time is 3:00 pm");
                saturday.Saturday.saturday();

                //Saturday();
            }


            //checks the time of day

            //bool t = IsTimeOver();
            //if (t == true)
            //{
            //    Console.WriteLine("time is over");
            //    Console.ReadKey();
            //}
            //else
            //{
            //    Console.WriteLine("time is not over");
            //    Console.ReadKey();

            //}
            string time = DateTime.Now.ToShortTimeString().ToString();
            //Console.WriteLine("The time now is {0}", time);
            //Console.WriteLine(DateTime.Now.ToLongTimeString().ToString());
            //Console.WriteLine(DateTime.Now.ToShortTimeString().ToString());

            //check if time to shutdown has reached



        }



        //code to restart the computer . and it works.

        //private static void Restart()
        //{
        //    ProcessStartInfo proc = new ProcessStartInfo();
        //    proc.WindowStyle = ProcessWindowStyle.Hidden;
        //    proc.FileName = "cmd";
        //    proc.Arguments = "/C shutdown -f -r ";
        //    Process.Start(proc);
        //}




    }
    class ShutDown
    {
        //code to shut down computer


        public static void shutdown()
        {
            Process.Start("shutdown", "/s /t 0");
        }
    }

}
namespace saturday
{

    class Saturday
    {

        public static readonly TimeSpan _whenTimeIsOver = new TimeSpan(15, 00, 00);
        internal static bool IsTimeOver()
        {
            return DateTime.Now.TimeOfDay.Subtract(_whenTimeIsOver).Ticks > 0;

        }
        public static void saturday()
        {

            bool t = IsTimeOver();
            if (t == true)
            {
                Console.WriteLine("computer shutting down now");
                int C;
                C = 1;

                while (C < 2000)
                {
                    C++;
                    Console.WriteLine("shutting down.....");
                    Console.WriteLine("in a minute");
                }
                Process.Start("shutdown", "/s /t 0");
                Console.ReadKey();
            }
            else
            {
                Console.WriteLine("not yet time");
                Console.ReadKey();
            }
        }
    }
}
